#include "Autopistol.h"

AutoPistol g_pAutoPistol;

void AutoPistol::Init()
{
	Active = true;
}

void AutoPistol::Enable()
{
	Active = true;
}

void AutoPistol::Disable()
{
	Active = false;
}

void AutoPistol::Set( bool Active )
{
	this->Active = Active;
}

void AutoPistol::Compute( CUserCmd* Cmd )
{
	static bool DoAttack = false;
	if (Active)
	{
		if((Cmd->buttons & IN_ATTACK))
		{
			if (GameUtilities::HasPistol())
			{
				if (DoAttack)	
					Cmd->buttons |=  IN_ATTACK;
				else
					Cmd->buttons &= ~IN_ATTACK;
				DoAttack = !DoAttack;
			}
		}
	}
}
